import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)


const routes =[
  {
    path:'/',
    name:'login',
    component:()=>import('../components/Login')
  },
  {
    path:'/Index',
    name:'index',
    component:()=>import('../components/Index'),
    children:[
      {
        path:'/Home',
        name:'home',
        meta:{
          title:'首页'
        },
        component:()=>import('../components/Home')
      },
      {
        path:'/Admin',
        name:'admin',
        meta:{
          title:'总管理'
        },
        component:()=>import('../components/admin/AdminManage')
      },
      {
        path:'/User',
        name:'user',
        meta:{
          title:'社团成员管理'
        },
        component:()=>import('../components/user/UserManage')
      },
      {
        path:'/Community',
        name:'community',
        meta:{
          title:'社团管理'
        },
        component:()=>import('../components/community/CommunityManage')
      },
      {
        path:'/Usegoods',
        name:'usegoods',
        meta:{
          title:'领用物品管理'
        },
        component:()=>import('../components/goods/UsegoodsManage')
      },
      {
        path:'/Useapply',
        name:'useapply',
        meta:{
          title:'领用申请审批'
        },
        component:()=>import('../components/use/UseapplyManage')
      },
      {
        path:'/Userecord',
        name:'userecord',
        meta:{
          title:'领用记录'
        },
        component:()=>import('../components/use/UserecordManage')
      },
      {
        path:'/Rentgoods',
        name:'rentgoods',
        meta:{
          title:'租用物品管理'
        },
        component:()=>import('../components/goods/RentgoodsManage')
      },
      {
        path:'/Rentapply',
        name:'rentapply',
        meta:{
          title:'租用申请审批'
        },
        component:()=>import('../components/rent/RentapplyManage')
      },
      {
        path:'/Rentrecord',
        name:'rentrecord',
        meta:{
          title:'租用记录'
        },
        component:()=>import('../components/rent/RentrecordManage')
      }
    ]
  }
]
const router = new VueRouter({
  mode:'history',
  routes
})

const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}
export default router;
